'''JohnsTicTacToe.py
test program for harness.

'''

def myNameIs():
   return "John's great Tic-Tac-Toe player"

def myCreatorIs():
   return "John M. Doe"

def makeMove(currentState):
   mySide = currentState[0]
   global utterance
   utterance = 'I wish '+mySide+' was in a better position.'
   ''' Now here is where the new state should be computed.
     The following code is a placeholder and should be replaced
     by something that makes a legal move.'''
   newState = findFirstMove(currentState)
   ''' End of the placeholder code'''
   return newState

def other(player):
   if player=='X': return 'O'
   else: return 'X'

def myUtterance():
   global utterance
   return utterance

def findFirstMove(currentState):
   mySide = currentState[0]
   board = currentState[1]
   for i in range(3):
      for j in range(3):
         if board[i][j] == ' ':
            board[i][j]=mySide
            return [other(mySide), board]
   global utterance
   utterance = "I was never very good at Tic-Tac-Toe!"
   return -1

